=========================================================================== BBS: The Abacus * HST/DS * Potterville, MI Date: 03-07-93 (16:58) Number: 19 From: EARL MONTGOMERY Refer#: NONE To: RICH GELDREICH Recvd: NO Subj: Screen 13 Compression Conf: (35) Quick Basi --------------------------------------------------------------------------- ' Rich, I finally found a copy of one of your Screen 13 ' compression routines. It was dated 24 Dec, 1991. It ' uses the Huffman routine. After studying it I decided to ' try to out do you! . Well I did to a certain extent. ' If you put the same graphics in yours that I have in mine, ' yours decompresses on my 386 in 48 seconds. Mine in 32. ' Your compression was 18209 bytes. Mine was 15181 bytes. ' The big problem with mine is that if A$ gets close to ' 16000 bytes I get an OUT of String Space error. Shouldn't ' I be able to get close to 32767 with a variable string with ' a $ sign after it? I would appreciate any comments you might ' have. DIM b$(10) DEFLNG A-Z: SCREEN 13: COLOR 4 REM Graphic portion LINE (80, 80)-(300, 150), RND * 255, BF LINE (0, 0)-(200, 2), , BF CIRCLE (100, 100), 100 PAINT (102, 102), 234, 4 LINE (0, 199)-(160, 199), 5 LINE (161, 199)-(319, 199), 4 FOR x = 0 TO 14 LINE (RND * 319, RND * 199)-(RND * 319, RND * 199), RND * 255 NEXT DEF SEG = &HA000 REM Reading how many times a value is repeated and the value REM Builing A$ FOR x = 0 TO 63999 p = PEEK(x) IF PEEK(x + 1) = p THEN cnt = cnt + 1: tempcnt = cnt: ELSE cnt = 1 IF cnt = 1 THEN a$ = a$ + STR$(tempcnt) + STR$(p): tempcnt = 1 NEXT OPEN "compress.bin" FOR OUTPUT AS #1 PRINT #1, a$ CLOSE : CLS OPEN "compress.bin" FOR INPUT AS #1 INPUT #1, a$ CLOSE : cnt = 0 REM This part is a little tricky. I am looking for a space in A$. Then REM finding the value to the left of it which gives me the marker value REM in the routine SetPix: step1: cnt = cnt + 1 b$ = LEFT$(a$, cnt) IF RIGHT$(b$, 1) = " " THEN a = VAL(LEFT$(b$, cnt)): marker = marker + a: a$ = R IGHT$(a$, LEN(a$) - cnt): cnt = 0: GOTO step2 GOTO step1 REM Looking for another space then finding the value to the left of it REM which gives me the color value (B) which I use in setpix. step2: cnt = cnt + 1 IF LEN(a$) = 1 THEN b = VAL(a$): GOTO setpix b$ = LEFT$(a$, cnt) IF RIGHT$(b$, 1) = " " THEN b = VAL(LEFT$(b$, cnt)): a$ = RIGHT$(a$, LEN(a$) - c nt): cnt = 0: GOTO setpix GOTO step2 REM Marker1 is initially 0 but after the loop equals marker. REM The next time around marker will increase in value. REM The IF x=64000 then 999 routine is a little Brute Force but at the REM time I couldn't figure a neat way to exit. REM After the loop we start the whole process again until x=64000 setpix: FOR x = marker1 TO marker POKE x, b IF x = 64000 THEN 999 NEXT marker1 = marker: GOTO step1 999 GOTO 999 Earl --- Maximus 2.01wb * Origin: Rabbit and Snake's BBS - Richardson, Texas (1:124/6108) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 950 203/23 209/209 280/1 SEEN-BY: 390/1 396/1 15 397/2 2230/100 3603/20